import request from "@/utils/request";

// 查询章节列表
export function listJuanChapter(query) {
  return request({
    url: "/system/juanChapter/getChapterList",
    method: "get",
    params: query,
  });
}

// 查询章节详细
export function getJuanChapter(chapterId) {
  return request({
    url: "/system/juanChapter/" + chapterId,
    method: "get",
  });
}

// 新增章节
export function addJuanChapter(data) {
  return request({
    url: "/system/juanChapter",
    method: "post",
    data: data,
  });
}

// 修改章节
export function updateJuanChapter(data) {
  return request({
    url: "/system/juanChapter",
    method: "put",
    data: data,
  });
}

// 删除章节
export function delJuanChapter(chapterId) {
  return request({
    url: "/system/juanChapter/" + chapterId,
    method: "delete",
  });
}


// 查询左侧树结构
export function leftTree() {
  return request({
    url: "/system/juanKnowledge/getLeftTree",
    method: "get",
  });
}

//查询课程树
export function courseTree(majorId) {
  return request({
    url: "/system/juanKnowledge/getCourseTree/"+majorId,
    method: "get",
  });
}

//查询课程树(章节左侧)
export function courseTreeList() {
  return request({
    url: "/system/juanChapter/getCourseTree",
    method: "get",
  });
}

//拖拽排序
export function chapterDrag(data) {
  return request({
    url: "/system/juanChapter/sort",
    method: "put",
    data
  });
}

